<?php

// $Id$


require_once($WSC->get_site_inc_dir().'modules/tangra_cms/pages/ci/base/ci_type_edit_wp.class.php');

require_once($WSC->get_site_inc_dir().'modules/tangra_cms/forms/_ci/ci_article/ci_article_form_ctrl.class.php');


class CI_Article_Edit_WP extends CI_Type_Edit_WP {
	public function create_view($name = 'default') {
		$ret = new TCMS_Admin_Page_View($this, $name, 'modules/tangra_cms/pages/_ci/');

		return $ret;
	}


	protected function init_transit_vars() {
		$this->add_transit_var('category');
		$this->add_transit_var('vpage');
	}


	protected function create_form_ctrl() {
		$dbc = $this->get_dbc();
		$tvm = $this->get_tvm();

		$config = $this->get__config();


		$type = new TCMS_CI_Type_DBC();
		if (!$type->load_by_hid($dbc, 'article')) {
			throw new Tangra_Module_Exception('Cannot load TCMS_CI_Type_DBC with hid = "article"');
		}

		$attribures = TCMS_CI_Type_Attr_DBC::select_all_for_ci_type($dbc, $type->get_id());

		$ret = new CI_Article_Form_Ctrl('ci_article', $tvm, $dbc, 'obj_id', $attribures);

		return $ret;
	}
}